package cn.kgc.controller;

import cn.kgc.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author 星哥
 * @version 1.0
 * @date 2023/2/23 - 9:49
 */
@RestController //以json返回
public class HelloWorldController {
    //把配置文件的内容注入到属性中
    @Value("${name}")
    private String name;
    @Autowired
    private Person person;

    @RequestMapping("/hello")
    public String hello(){
        return "hello-springboot!!!"+name+person.getName()+"\t"+person.getSex()+"\t"+person.getAge();
    }





















}
